'use strict'


import Http from '../kit/HttpKit'
import Api from './Api'

const URL_LIST = Api.API_URL + '/activity/list'
const URL_RECOMMEND_LIST = Api.API_URL + '/activity/recommendList'
const URL_SETTING_RECOMMEND = Api.API_URL + '/activity/settingRecommend'
const URL_CANCEL_RECOMMEND = Api.API_URL + '/activity/cancelRecommend'
const URL_DELETE = Api.API_URL + '/activity/delete'
const URL_CHECK_STATUS_PASS = Api.API_URL + '/activity/checkStatusPass'
const URL_CHECK_STATUS_FAIL = Api.API_URL + '/activity/checkStatusFail'

/**
* 活动信息模块
**/
const list = (data, callback)=>{
	var url = Api.API_URL + '/activity/list';

	data.api_token = Api.getApiToken();
	data.api_user_id = Api.getApiUserId();

	Http.post(url, data, json=>{
		Api.getDataCB(json, callback);
	});
}
const recommendList = (data, callback)=>{
	data.api_token = Api.getApiToken();
	data.api_user_id = Api.getApiUserId();
	Http.post(URL_RECOMMEND_LIST, data, json=>{
		Api.getDataCB(json, callback);
	});
}

const detail = (activityId, callback)=>{
	var url = Api.API_URL + '/activity/detail';

	let data = {id: activityId};
	data.api_token = Api.getApiToken();
	data.api_user_id = Api.getApiUserId();

	Http.post(url, data, json=>{
		Api.getDataCB(json, callback);
	});
}

const jst = (data, callback)=>{
	var url = Api.API_URL + '/activity/giveJst';

	data.api_token = Api.getApiToken();
	data.api_user_id = Api.getApiUserId();

	Http.post(url, data, json=>{
		Api.getDataCB(json, callback);
	});
}

const getPushNum = (data, callback)=>{
	var url = Api.API_URL + '/activity/getPushNum';

	data.api_token = Api.getApiToken();
	data.api_user_id = Api.getApiUserId();

	Http.post(url, data, json=>{
		Api.getDataCB(json, callback);
	});
}

export default{
	list,recommendList, detail,jst,getPushNum,
	URL_LIST, URL_RECOMMEND_LIST,URL_SETTING_RECOMMEND,URL_CANCEL_RECOMMEND,URL_DELETE, URL_CHECK_STATUS_PASS, URL_CHECK_STATUS_FAIL
}
